import req, { RequsetOptons } from "/@/api/req";
import { AddApplicationToTenantParams, ApplicationItem, GetApplicationByTenantParams } from "./models";

export enum Api {
  getApplicationByTenant = "api/system/oauth/getApplicationByTenant",
  applicationsPage = "api/system/applications/page",
  addApplication = "api/system/applications/addApplication",
  deleteApplicationByIds = "api/system/applications/deleteApplicationByIds",
  updateApplication = "api/system/applications/updateApplication",
  addApplicationToTenant = "api/system/applications/addApplicationToTenant",
}

export function getApplicationByTenant(data: GetApplicationByTenantParams, options?: RequsetOptons) {
  return req.post<ApplicationItem[]>(
    {
      data,
      url: Api.getApplicationByTenant,
    },
    options
  );
}

export function addApplicationToTenant(data: AddApplicationToTenantParams) {
  return req.post<boolean>({
    data,
    url: Api.addApplicationToTenant,
  });
}
